<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../layuimini-2/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuimini-2/css/layuimini.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<!--编辑页面-->
<div class="layui-form layuimini-form">

    <!-- 隐藏-->
    <input type="hidden" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label required">楼层</label>
        <div class="layui-input-inline">
            <input type="text" name="floor" lay-verify="required" lay-reqtext="楼层不能为空" placeholder="请输入楼层" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">面积</label>
        <div class="layui-input-inline">
            <input type="text" name="room" lay-verify="required" lay-reqtext="房间不能为空" placeholder="请输入房间号" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">面积</label>
        <div class="layui-input-inline">
            <input type="text" name="area" lay-verify="required" lay-reqtext="面积不能为空" placeholder="请输入面积" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">参会人数</label>
        <div class="layui-input-inline">
            <input type="text" name="num" lay-verify="required" lay-reqtext="人数不能为空" placeholder="请输入参会人数" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">会议时间</label>
        <div class="layui-input-inline">
            <input type="text" name="recTime" id="recTime" lay-verify="required" lay-reqtext="预定时间不能为空" placeholder="请输入预定时间" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">结束时间</label>
        <div class="layui-input-inline">
            <input type="text" name="endTime" id="endTime" lay-verify="required" lay-reqtext="结束时间不能为空" placeholder="请输入结束时间" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">租金</label>
        <div class="layui-input-inline">
            <input type="text" name="rent" lay-verify="required" lay-reqtext="租金不能为空" placeholder="请输入租金" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">预订人</label>
        <div class="layui-input-inline">
            <input type="text" name="recName" lay-verify="required" lay-reqtext="预定人不能为空" placeholder="请输入预订人姓名" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">预订人电话</label>
        <div class="layui-input-inline">
            <input type="text" name="tel" lay-verify="required" lay-reqtext="预定人不能为空" placeholder="请输入预订人电话" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">会议主题</label>
        <div class="layui-input-inline">
            <input type="text" name="recSubject" lay-verify="required" lay-reqtext="主题不能为空" placeholder="请输入会议主题" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>

<script src="../../../layuimini-2/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            laydate= layui.laydate,
            $ = layui.$;

        setTimeout(function () {
            form.render();//重新渲染表格
        },50);//定时

        //对时间进行渲染
        laydate.render({
            elem:'#recTime' //指定元素
        });
        laydate.render({
            elem:'#endTime'//指定元素
        });

        /**
         * 监听提交编辑数据
         */

        form.on('submit(saveBtn)', function (obj) {
            $.ajax({
                url:"/reception/update.do",
                type:"get",
                data:obj.field,
                success:function (ret) {
                    if (ret.code==0) {
                        let index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    } else {
                        layer.msg("编辑信息失败");
                    }
                },
                error:function (ret) {
                    layer.msg("服务器忙!!")
                }
            })
            return false;//防止自动提交表单
        })

    });
</script>
</body>
</html>